//
//  HJSelectCityCell.m
//  KaiChat
//
//  Created by lx on 2023/12/20.
//

#import "HJSelectCityCell.h"

@interface HJSelectCityCell()

@property (nonatomic, weak) UILabel *titleLabel;
@property (nonatomic, weak) UILabel *detailTitleLabel;
@property (nonatomic, weak) UIImageView *checkImageView;
@property (nonatomic, weak) UIView *lineView;


@end


@implementation HJSelectCityCell


- (void)settingSubView {
 
    self.backgroundColor = UIColor.whiteColor;
        
    _titleLabel = [UILabel lableWithSuperView:self.contentView font:UIFontMake(14) color:UIColor.tj_333333Color title:nil textAlignment:NSTextAlignmentLeft];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(leftRightMargin);
        make.centerY.offset(0);
    }];
    
    _detailTitleLabel = [UILabel lableWithSuperView:self.contentView font:UIFontMake(14) color:UIColor.tj_868391Color title:nil textAlignment:NSTextAlignmentRight];
    [_detailTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.inset(leftRightMargin);
        make.centerY.offset(0);
        make.width.mas_lessThanOrEqualTo(200);
    }];
    
    UIImageView *checkImageView = [UIImageView addToView:self.contentView];
    checkImageView.image = [UIImage imageNamed:@"check"];
    checkImageView.hidden = YES;
    [checkImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.inset(leftRightMargin);
        make.centerY.offset(0);
    }];
    
    _lineView = [UIView addToView:self.contentView];
    _lineView.hidden = YES;
    _lineView.backgroundColor = UIColor.tj_separatorColor;
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.inset(leftRightMargin);
        make.top.offset(0);
        make.height.offset(lineHeight);
    }];
    
    _checkImageView = checkImageView;
}

- (void)prepareForReuse {
    [super prepareForReuse];
    
    _lineView.hidden = YES;
}

- (void)setModel:(HJCellModel *)model {
    _model = model;
    
    _titleLabel.text = model.text;
    _detailTitleLabel.text = model.detailText;
    
    if (model.isSelect) {
        self.backgroundColor = UIColor.tj_F6F6F6Color;
        _checkImageView.hidden = NO;
    } else {
        self.backgroundColor = UIColor.whiteColor;
        _checkImageView.hidden = YES;
    }
    
    _lineView.hidden = !model.showLine;
}
 

@end

 
